import React,{useEffect,useState} from 'react';
import axios from "axios"
import Hoclogin from "../../../untlis/Hoclogin";
import { Popup, Cell} from 'react-vant';
import "./my.css"
function My() {
    
    interface ARRTYPES{
        name:string;
        id:string;
        price:string;
        title:string;
        map:any;
    }
    const [arr,setarr]=useState<ARRTYPES>()
    const [value,setvalue]=useState("")
    // console.log(arr);
    useEffect(() => {
        axios.get("/list").then(res=>{
            // console.log(res);
            setarr(res.data)
        })
    }, [])
    const [visible, setVisible] = useState(false);
    return (
        <div>
            <p className="p1">选着收货地址</p><button className="bu1" onClick={()=>setVisible(true)}>新增地址</button>
            <br/>
            {
               arr&&arr.map((item:any,index:any)=>{
                    return <div  key={index} className="bx1">
                        <p>姓名:{item.name}</p>
                        <p>地址:{item.title}  <button>删除</button> <button onClick={()=>setVisible(true)}>编辑</button></p>
                       
                    </div>
                })
            }
    <Cell />
      <Popup
        visible={visible}
        onClose={() => {
          setVisible(false);
        }}
      >
        <div style={{ padding: '100px 200px' }}>
        姓名:<input /><br/>
        地址:<input /><br/>
        电话:<input /><br/>
        </div>
      </Popup>
        </div>
    )
}

export default Hoclogin(My)
